# -*- coding: utf-8 -*-
'''
@author: wangwl
@file: docker
@time: 2021/07/6 10:57
@desc:
'''
import time
from utils.socket_utils import socket_connect


class DeployGeneral():
    @staticmethod
    def service_start_judgment(info_dict, time_numbe=20, time_interval=5):
        """
        info_dict:{check_code:'', host_ip:'', check_url:''}
        """
        for number in range(1, time_numbe):
            time.sleep(time_interval)

            if info_dict['check_code'] == "port": #端口验证
                if socket_connect(info_dict['host_ip'], info_dict['check_url'], 3):
                    return True

        return False
